﻿using Quartz;
using Quartz.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zj.Blog.Quarz.Net
{
    public class TaskRun
    {
        private static IScheduler _scheduler;
        static TaskRun()
        {
            ISchedulerFactory sf = new StdSchedulerFactory();
            _scheduler = sf.GetScheduler();
        }
        public static void Start()
        {
            IJobDetail job = JobBuilder.Create(typeof(TimeJob)).WithIdentity("gainOrloss","Advance9").Build();
            ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(5)).WithCronSchedule("/2 * * ? * * ").Build();
            _scheduler.ScheduleJob(job,trigger);
            _scheduler.Start();
        }

    }
}
